package org.example.system.api.feign;

import org.example.common.base.constants.SecurityConstants;
import org.example.common.base.constants.ServiceNameConstants;
import org.example.common.base.util.web.R;
import org.example.system.api.entity.LoginUser;
import org.example.system.api.factory.RemoteUserFallbackFactory;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestHeader;

/**
 * @version 1.0.0
 * @className: RemoteUserService
 * @description:
 * @author: LiJunYi
 * @create: 2022/8/2 14:14
 */
@FeignClient(contextId = "remoteUserService", value = ServiceNameConstants.SYSTEM_SERVICE, fallbackFactory = RemoteUserFallbackFactory.class)
public interface RemoteUserService
{
    /**
     * 通过用户名查询用户信息
     *
     * @param username 用户名
     * @param source 请求来源
     * @return 结果
     */
    @GetMapping("/sys/user/info/{username}")
    R<LoginUser> getUserInfo(@PathVariable("username") String username, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);
}
